Skip to content

✨ Add nth_t and nth_v#203

Merged
elbeno merged 1 commit intointel:mainfrom
elbeno:add-nth
Mar 5, 2025
Merged

✨ Add nth_t and nth_v#203
elbeno merged 1 commit intointel:mainfrom
elbeno:add-nth

Conversation

@elbeno
Copy link
Contributor

@elbeno elbeno commented Mar 5, 2025

Problem:

  • It's annoying to make a type list just to index into it.
  • Boost.MP11 doesn't provide mp_at that works on value lists.

Solution:

  • Introduce nth_t<Index, Ts...> and nth_v<Index, Vs...> to give the nth type or value of a pack respectively.

@elbeno elbeno force-pushed the add-nth branch 2 times, most recently from ed33475 to 11c9a92 Compare March 5, 2025 04:26
Copy link
Contributor

@lukevalenty lukevalenty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome utility!!

Problem:
- It's annoying to make a type list just to index into it.
- Boost.MP11 doesn't provide `mp_at` that works on value lists.

Solution:
- Introduce `nth_t<Index, Ts...>` and `nth_v<Index, Vs...>` to give the nth type
  or value of a pack respectively.
@elbeno elbeno enabled auto-merge March 5, 2025 17:49
@elbeno elbeno merged commit 7725142 into intel:main Mar 5, 2025
36 checks passed
@elbeno elbeno deleted the add-nth branch March 5, 2025 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants